//
//  DSZShowTabbarView.m
//  7.13苏宁框架
//
//  Created by lovena on 15/7/14.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZShowTabbarView.h"

@implementation DSZShowTabbarView

-(id)initWithFrame:(CGRect)frame
{
    return [[[NSBundle mainBundle]loadNibNamed:@"DSZShowTabbarView" owner:nil options:nil] lastObject];
}
-(void)awakeFromNib
{
    [self clickBtn:_firstBtn];

}
- (IBAction)clickBtn:(UIButton *)sender {
    if (_selectedBtn!=sender) {
        _selectedBtn.selected=NO;
        //标题变回百色
        NSInteger index=_selectedBtn.tag;
        UILabel *label=_titleLabel[index];
        label.textColor=[UIColor whiteColor];
    }
    //当前选中的按钮操作
    sender.selected=YES;
    NSInteger index2=sender.tag;
    UILabel *label2=_titleLabel[index2];
    label2.textColor=[UIColor colorWithRed:231/255.0 green:146/255.0 blue:10/255.0 alpha:1];
    _selectedBtn=sender;
    
    //代理
    if([self.delegate respondsToSelector:@selector(didselectedView:)])
    {
        [self.delegate didselectedView:sender.tag];
    }
    
}


@end
